﻿namespace TestModel.Model
{
    /// <summary>
    /// 操作数据接口
    /// </summary>
    internal interface IOperateAccess<T>
    {
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="t">数据类型</param>
        void Insert(T t);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="condition">条件</param>
        void Delete(Condition<T> condition);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="t">数据</param>
        /// <param name="condition">条件</param>
        void Update(T t, Condition<T> condition);

        
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="condition">条件</param>
        /// <returns>查询的结果</returns>
        List<T> Query(Condition<T> condition);
    }

    /// <summary>
    /// 判断条件
    /// </summary>
    /// <typeparam name="T">数据类型</typeparam>
    /// <param name="value">数据</param>
    public delegate bool Condition<T>(T value);
}
